import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router/auth'

import '@/icons' // icon
import '@/permission' // permission control
import imgerror from './utils/imgerror'
import components from './components/index'
import * as filters from '@/filters'
import Print from 'vue-print-nb'

// 注册全局过滤器
Object.keys(filters).forEach(key => { // 引入所有过滤器进行注册，从对象中取值一般用对象[键名]，用.的方式得到结果为undefined
  // console.log(key, filters[key])
  Vue.filter(key, filters[key])
})

// set ElementUI lang to EN
Vue.use(ElementUI, { locale })
Vue.use(components)
Vue.use(Print)

// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)
// 自定义指令处理图像图片不显示问题
Vue.directive('imgerror', imgerror)

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
